All Questions
Tagged with bashshell-script
6,898 questions
-4votes
0answers
55views
Creating in Linux files in GB or MB range by various random size by read a file [closed]
In Linux in Bash i have this script (thanks to Ed Morton) . $ cat ./tst.sh #!/usr/bin/env bash while read -r idx sfx size; do echo fallocate "file${idx}.${sfx}" "$size" done &...
-2votes
1answer
111views
Creating in Linux files in GB or MB range by various size by read a file [closed]
In Linux with Bash, there is the File numbers_in_one_line. In this file there is only one line with several numbers, all separated by spaces. These numbers are the value in bytes for creating files ...
-1votes
2answers
83views
Counting unique IP addresses per hour in existing log files
I am trying to determine the number of unique web visitors to my website each hour. The log files (access*.log) contain many lines looking similar to this. 192.168.211.85 - - [29/Sep/2024:10:17:02 -...
14votes
1answer
3kviews
Why does cd '' succeed in bash?
Maybe I'm missing it, but I don't find it documented that cd '' should succeed. Since there is no directory with the name '', it seems obvious that it should fail. For example, mydir= cd -- "$...
-3votes
1answer
97views
bash -n is a not documented in manpages or info documents [closed]
Even though bash -n is a valid and widely used option, some manpages don't clearly document it in the bash options section, even though it is implemented. It's also not in the GNU Bash Reference ...
0votes
1answer
87views
How to create splittet random files and join them with dmsetup
In Linux in Bash, there is a script, a part of the script is this while true ; do echo awk -v x=$(<"$TEMPDIR"size_container_in_byte) -v n=$(<"$TEMPDIR"parts) 'BEGIN{...
0votes
1answer
104views
How to compare output of a program with a reference value in a shell script?
I have my own implementation of a Redis server which I'd like to test through a shell script. The general idea is to feed it with some commands through nc, and since nc prints the output of my program ...
0votes
2answers
97views
How to redirect output from a program that waits for input
Following this post I created my own version of the script, with the difference that user and password are forwarded from the environment variables: #!/bin/zsh pamtester login $user authenticate <&...
-7votes
2answers
94views
How can I pick random items from a list, but some more often than others, in a Bash config file? [closed]
In Linux, using Bash, I have two scripts: script.sh is the main script, and script_config.sh is the configuration for script.sh. In script.sh, I do source script_config.sh to load all the config ...
0votes
2answers
85views
How to analyse a number of different datasets with a script and save the output for each dataset in a different new directory?
I am interested in analysing 50 different datasets with a script and saving the output of each of the 50 analyses in 50 different corresponding directories. To avoid doing this manually, how could ...
0votes
2answers
79views
How to "catch" the output of a command? [duplicate]
I'm struggling with the vocabulary here, so I'll ask this way: On an embedded system (Raspberry Pi) I use, there is a command invoked as follows: $ pin-control poll 25 This command "polls"...
1vote
1answer
66views
How can a bash script determine how it was started? [duplicate]
I am running various scripts on Debian 12.X currently with the following bash: GNU bash, version 5.2.15(1)-release (x86_64-pc-linux-gnu) I have the following methods/options to execute the script. ...
-3votes
1answer
50views
Rename files, remove the first four signs [duplicate]
There are many files in this format: IMG_20240717_191421.jpg IMG_20240620_165358_BURST001_COVER.jpg IMG_20240624_173513_2.jpg how can they renamed in Linux in Bash to: 20240717_191421.jpg ...
0votes
5answers
128views
Move/mark files and the associated-part too
There is a folder with many files in it: 112.mkv 123.md5 123.mkv 221.mkv 467.mkv aa1.mkv abc.md5 abc.mkv bbc.mkv dde.md5 dde.mkv ggh.mkv .... xxy.md5 xxy.mkv xxz.mkv How can I move .md5 files and the ...
0votes
2answers
24views
create unique folder on startup with rpi cam
I have a pi cam on a pi zero that needs to run for the whole duration of being on. this pi camera module is being used in stratospheric launch and during our last one we were able to get videos back, ...